package com.yuan.SMS.controller;

import com.alibaba.fastjson.JSON;
import com.yuan.SMS.dao.StudentDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;

@RestController
public class DeleteController {
    @Autowired
    StudentDao ddao;

    @RequestMapping("/delete")
    @CrossOrigin("http://localhost:8080")
    public String deleteStudent(String studentNo){
        System.out.println(studentNo);
        int i = ddao.deleteStudent(studentNo);
        HashMap<String, Object> res = new HashMap<>();
        if(i>0){
            res.put("flag","success");
        }else{
            res.put("flag","error");
        }
        return JSON.toJSONString(res);
    }
}
